#pragma once 
#include <filesystem>
#include <ftp_permission.h>

#if WIN32
constexpr char FILE_PATH_SEP = '\\';
constexpr const char* PARENT_DIR = "..\\";
#else 
constexpr char FILE_PATH_SEP = '/';
constexpr const char* PARENT_DIR = "../";
#endif

namespace FTPUtil {

		/// <summary>
		/// 获取单一文件unix风格信息
		/// </summary>
		/// <param name="filename"></param>
		/// <param name="info"></param>
		/// <returns></returns>
		bool getSingleFileInfo(const std::string& filename, std::string& info, UserPermission permission = UserPermission::All);

		/// <summary>
		/// 获取普通文件、目录的文件信息
		/// </summary>
		/// <param name="filename">文件路径</param>
		/// <param name="info">文件info</param>
		/// <returns></returns>
		bool getFileInfo(const std::string& filename, std::string& info, UserPermission permission = UserPermission::All);

		/// <summary>
		/// 判断文件、目录是否存在
		/// </summary>
		/// <param name="filename">文件路径</param>
		/// <returns></returns>
		bool exist(const std::string& filename);

		bool mkdir(const std::string& dirname);

		bool rmdir(const std::string& dirname);

		bool getFileSize(const std::string& filename, size_t& filesize);

		bool tryDelete(const std::string& filename);

		bool tryReName(const std::string& oldName, const std::string& newName);

		/// <summary>
		/// 检查文件名是否合法，不包含目录名
		/// </summary>
		/// <param name="filename"></param>
		/// <returns></returns>
		bool checkFilenameLegal(const std::string& filename);
}
